<?php include template('header','common');?>
<link rel="stylesheet" type="text/css" href="{__ROOT__}template/default/statics/css/swiper.css?v={HD_VERSION}">
<link rel="stylesheet" type="text/css" href="{__ROOT__}template/default/statics/css/laoshi-pinlun.css?v={HD_VERSION}">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">

<div class="container" style="margin-bottom:60px;">
	<div class="swiper-container swiper-container-2">
		<div class="pinglun swiper-wrapper swiper-slide-prev">
			<?php foreach($students as $k => $v){?>
			<div class="swiper-slide">
            	<div id="head{$v['id']}" student_id="{$v['id']}" style="position:relative;">
				{if $v['head'] == './template/default/statics/images/member/default_head.png'}
				<img src="{$v['head']}" alt="">
                <div id="head{$v['id']}text" style="height: 50px; width:40px; position:absolute; font-size:10px; top:5px; left:32%;">上传孩子头像用于点名</div>
				{else}
				<img src="{$v['head']}" alt="">
				{/if}
                </div>
				<span>{$v['truename']}</span>
			</div>
			<?php }?>
		</div>
		<!-- Add Pagination -->
		<style>
.tag-no{font-size:14px; color:#97c619; border:1px solid #97c619; height:20px; line-height:20px; padding:0 5px; float:left; margin:3px 5px 3px 0;}
</style>
		<div class="name">
			<div class="swiper-wrapper">
				<?php foreach($students as $k => $v){?>
				<div class="swiper-slide">
					{if $v['class_id'] > 0 && $v['orderInfo']['pay_status'] == 1}
					<div class="pinglun-list">
						<div style="justify-content: center;">
							<span class="swiper-name">当天表现</span>
						</div>
						
						<div>
							<label for="rate" >吃饭</label>
							<select id="example-fontawesome{$k}1" name="rating">
								<option value="1">1</option>
								<option value="2">2</option>
								<option value="3">3</option>
								<option value="4">4</option>
								<option value="5">5</option>
							</select>
						</div>
						<div>
							<label for="attitude">睡觉</label>
							<select id="example-fontawesome{$k}2" name="rating">
								<option value="1">1</option>
								<option value="2">2</option>
								<option value="3">3</option>
								<option value="4">4</option>
								<option value="5">5</option>
							</select>
						</div>
						<div style="align-items: flex-start;">
							<label for="skill">纪律</label>
							<div class="skill-tag">
								<?php $tag = $v['scoring']['disciplineNum'];
								$tag = explode(',',$tag);
								foreach($tag as $vv){
									if($vv) echo "<span>".$vv."</span>";
								}
								?>								
							</div>
						</div>
						<!--div>
							<label for="skill" style="width: 28px; display: inline-table;">纪律</label>
							<span style="color:#97c619; width:130px; text-align:left; padding-left:10px;"><font class="tag tag-no">{$v['scoring']['disciplineNum']}</font></span>
						</div-->
					</div>
					
					<div class="juti-list">
						<a href="{url('order/order/jf',array('sid'=>$v['id']))}">
							<img src="{__ROOT__}template/default/statics/img/jiaofei.png" alt="">
							<i>缴费</i>
						</a>
						<a href="{url('member/point/leave',array('sid'=>$v['id']))}">
							<img src="{__ROOT__}template/default/statics/img/qingjia1.png" alt="">
							<i>请假</i>
						</a>
						<a href="{url('member/point/index',array('sid'=>$v['id']))}">				
							<img src="{__ROOT__}template/default/statics/img/dafen.png" alt="">
							<i>评分</i>							
						</a>
					</div>
					{else}					
					<div class="pinglun-list">						
						<div class="btn-view">
                        {if $v['isClass'] == 1}
                        <button type="button" class="faqiBtn btn2" sid="{$v['id']}">缴费</button>
                        {else}
						<button type="button" class="faqiBtn btn2" sid="{$v['id']}">发起</button>
                        {/if}
						</div>
					</div>
					
					{/if}					
				</div>
				<?php }?>
			</div>
		</div>
	</div>
	<div class="qianbao">
		<a class="qianbao-item" href="{url('member/money/log')}">
			<img src="{__ROOT__}template/default/statics/img/qianbao.png" alt="">
			<span>我的钱包</span>
			<img src="{__ROOT__}template/default/statics/img/jiantou1.png" alt="">
		</a>
		<a class="qianbao-item" href="{url('member/student/index')}">
			<img src="{__ROOT__}template/default/statics/img/guanli.png" alt="">
			<span>校内紧急联络人</span>
			<img src="{__ROOT__}template/default/statics/img/jiantou1.png" alt="">
		</a>
        <a class="qianbao-item" href="{url('member/student/add')}">
			<img src="{__ROOT__}template/default/statics/img/guanli.png" alt="">
			<span>添加孩子</span>
			<img src="{__ROOT__}template/default/statics/img/jiantou1.png" alt="">
		</a>
	</div>
</div>
<link type="text/css" rel="stylesheet" href="{__ROOT__}statics/js/upload/uploader.css?v={HD_VERSION}" />
<script type="text/javascript" src="{__ROOT__}statics/js/upload/uploader.js?v={HD_VERSION}"></script>
<script type="text/javascript" src="{__ROOT__}template/default/statics/js/swiper-3.4.2.min.js"></script>
<script>
	<?php foreach($students as $k => $v){?>
	upload("head{$v['id']}");
	<?php }?>
	function upload(obj){
		var uploader = WebUploader.create({
			auto:true,
			fileVal:'upfile',
			// swf文件路径
			swf: '{__ROOT__}statics/js/upload/uploader.swf',
			// 文件接收服务端。
			server: "<?php echo url('attachment/index/upload')?>",
			// 选择文件的按钮。可选
			formData:{
				file : 'upfile',
				upload_init : '<?php echo $attachment_init ?>'
			},
			quality: 80,
			// 压缩图片大小
			compress:{
				width: 408,
				height: 408,
				allowMagnify: false
			},
			// 内部根据当前运行是创建，可能是input元素，也可能是flash.
			pick: {
				id: '#'+obj,
				multiple:false
			},
			accept:{
				title: '图片文件',
				extensions: 'gif,jpg,jpeg,bmp,png',
				mimeTypes: 'image/*'
			},
			chunked: false,
			chunkSize:1000000,
			resize: false
		});
		uploader.onFileQueued = function(file){
			alerts("图片上传中...", 3);
		}
		uploader.onUploadError = function(file,reason){
			alerts("图片上传失败");
		}
		uploader.onUploadSuccess = function(file, response) {
			if(response.status == 1) {
				alerts("图片上传成功");
				var student_id = $("#"+obj).attr('student_id');
				
				var ajaxurl="<?php echo url('member/student/head')?>";
				$.post(ajaxurl,{'student_id':student_id,'head':response.result.url,w:response.result.width,h:response.result.height},function(ret){
					if(ret.status == 1){
						$("#"+obj+"text").hide();
						$("#"+obj).find('img').attr("src", '{__ROOT__}'+ret.result);
					}
				},'json');
			} else {
				alerts(response.message);
			}
		}	
	}
	var count = {$count};
    var galleryTop = new Swiper('.swiper-container-2', {
        pagination: '.swiper-pagination',
        slidesPerView: 3,
        spaceBetween: 10,
        centeredSlides: true,
        grabCursor: true,
        initialSlide: 1,
    });
    var galleryThumbs = new Swiper('.name', {
        spaceBetween: 10,
        centeredSlides: true,
        slidesPerView: 'auto',
        touchRatio: 0.2,
        initialSlide: 1,
        slideToClickedSlide: true
    });
    galleryTop.params.control = galleryThumbs;
    galleryThumbs.params.control = galleryTop;
	
	$(".faqiBtn").click(function(){
		var sid = $(this).attr('sid');		
		var ajaxurl="<?php echo url('member/index/validation')?>"+"&sid="+sid;
		window.location.href=ajaxurl;
	});
	
	$(".payBtn").click(function(){
		var sn = $(this).attr('sn');
		var sid = $(this).attr('sid');
		var ajaxurl="<?php echo url('order/order/detail')?>"+"&order_sn="+sn+"&sid="+sid;
		window.location.href=ajaxurl;
	});
	
	$(".showBtn").click(function(){
		var sn = $(this).attr('sn');
		var sid = $(this).attr('sid');
		var ajaxurl="<?php echo url('order/order/show')?>"+"&order_sn="+sn+"&sid="+sid;
		window.location.href=ajaxurl;
	});
</script>
<script src="{__ROOT__}template/default/statics/js/jquery.barrating.js"></script>
<script>
    $(function () {
        function ratingEnable() {
			<?php foreach($students as $k => $v){?>
            $('#example-fontawesome<?php echo $k;?>1').barrating({
                theme: 'fontawesome-stars',
				initialRating:<?php echo $v['scoring']['mealNum'];?>,
                showSelectedRating: false,
				readonly:true
            });
			$('#example-fontawesome<?php echo $k;?>2').barrating({
                theme: 'fontawesome-stars',
				initialRating:<?php echo $v['scoring']['bedNum'];?>,
                showSelectedRating: false,
				readonly:true
            });	
			<?php }?>
        }
        ratingEnable();
    });
</script>
<?php include template('footer','common');?>